/*
package com.tools.helper;

import android.app.Activity;
import android.bluetooth.BluetoothDevice;
import android.os.Bundle;
import android.os.Handler;

import com.hjy.bluetooth.HBluetooth;
import com.hjy.bluetooth.inter.ConnectCallBack;
import com.hjy.bluetooth.inter.ReceiveCallBack;
import com.hjy.bluetooth.inter.ScanCallBack;
import com.hjy.bluetooth.operator.abstra.Sender;

import java.io.DataInputStream;
import java.util.List;


public class MainActivity2 extends Activity {

    Handler handler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn1).setOnClickListener(v -> {
            test();
        });
        findViewById(R.id.btn2).setOnClickListener(v -> {
			conn();
        });
		HBluetooth.getInstance().enableBluetooth();

		//请填写你自己设备的UUID
		//低功耗蓝牙才需要如下配置BleConfig,经典蓝牙不需要new HBluetooth.BleConfig()
		HBluetooth.getInstance().setReceiver(new ReceiveCallBack() {
			@Override
			public void onReceived(DataInputStream dataInputStream, byte[] result) {
				System.out.println("aaaaaaa====onReceived====== " + result);
			}
		});
    }

	private void conn() {
		HBluetooth.getInstance().connect(device, new ConnectCallBack() {
			@Override
			public void onConnecting() {

			}

			@Override
			public void onConnected(Sender sender) {
				System.out.println("aaaaaa=== " + sender);
			}

			@Override
			public void onDisConnecting() {

			}

			@Override
			public void onDisConnected() {

			}

			@Override
			public void onError(int errorType, String errorMsg) {
				System.out.println(errorMsg);
			}
		});
	}

    private void test() {
		HBluetooth.getInstance().scan(BluetoothDevice.DEVICE_TYPE_LE, 6000, new ScanCallBack() {
			@Override
			public void onScanStart() {
				System.out.println("adfsdf start");
			}

			@Override
			public void onScanning(List<com.hjy.bluetooth.entity.BluetoothDevice> scannedDevices, com.hjy.bluetooth.entity.BluetoothDevice currentScannedDevice) {
				//System.out.println("aaaaaaaaaaaaaa== " + currentScannedDevice.getName());
			}

			@Override
			public void onError(int errorType, String errorMsg) {
				System.out.println(errorMsg);
			}

			@Override
			public void onScanFinished(List<com.hjy.bluetooth.entity.BluetoothDevice> bluetoothDevices) {
				System.out.println("aaaaaaaaaa== " + bluetoothDevices.size());
				for (com.hjy.bluetooth.entity.BluetoothDevice d : bluetoothDevices) {
					if (d.getName() != null && d.getName().length() > 0) {
						device = d;
						System.out.println(d.getName());
						byte[] red = d.getScanRecord();
						System.out.println(new String(red));
						new BleParser().parseRecord(red);
						break;
					}
				}
			}
		});
    }

	com.hjy.bluetooth.entity.BluetoothDevice device;
}
*/
